package repository.relsys.main;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;
import java.util.Collection;
import java.util.LinkedList;

import repository.relsys.domainmodel.ltool.interfaces.Blog;
import repository.relsys.domainmodel.ltool.interfaces.ContactList;
import repository.relsys.domainmodel.ltool.interfaces.Feature;
import repository.relsys.domainmodel.ltool.interfaces.GeneralInformation;
import repository.relsys.domainmodel.ltool.interfaces.TechnicalInformation;
import repository.relsys.domainmodel.ltool.pojos.BlogCls;
import repository.relsys.domainmodel.ltool.pojos.ContactListCls;
import repository.relsys.domainmodel.ltool.pojos.GeneralInformationCls;
import repository.relsys.domainmodel.ltool.pojos.LearningToolCls;
import repository.relsys.domainmodel.ltool.pojos.TechnicalInformationCls;
import thewebsemantic.Bean2RDF;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;

public class Main {

	public static void main(String[] args) throws FileNotFoundException {
		try {
			Model m = ModelFactory.createDefaultModel();
			m.setNsPrefix("lt",
					"http://diplomski.nelakolundzija.org/LTontology.rdf#");
			Bean2RDF writer = new Bean2RDF(m);

			LearningToolCls lt = new LearningToolCls();
			lt.setTitle("WordPress");

			GeneralInformation gi = new GeneralInformationCls();
			gi.setDescription("WordPress is ...");
			gi.setToolURL("http://www.wordpress.com");

			TechnicalInformation ti = new TechnicalInformationCls();
			ti.setLaunchedTime("12-01-2001");
			ti.setVersion("2.9");
			ti.registration(true);
			ti.isOpenSource(false);

			Collection<Feature> features = new LinkedList<Feature>();
			Blog blog = new BlogCls();
			ContactList folowers = new ContactListCls();
			features.add(blog);
			features.add(folowers);

			lt.setFeatures(features);
			lt.setGeneralInfo(gi);
			lt.setTechnicalInfo(ti);

			writer.save(lt);

			m.write(new FileOutputStream("LearningTools.rdf"), "RDF/XML");
			m.write(System.out, "RDF/XML");

		} catch (Exception e) {
			System.out.println("Error");

		}
	}

}
